<template>
    <el-dialog
        class="dialog"
        :destroy-on-close="true"
        title="扫码开门二维码"
        :visible.sync="isShow"
        :close-on-click-modal="false"
        @close="onDialogClose">
        <el-form
            ref="form"
            label-width="auto"
            class="form"
            :model="formData"
        >
            <el-form-item label="门禁名称">
                {{infoData.door_name}}
            </el-form-item>
            <el-form-item  prop="param1">
                <vue-qr
                ref="qrcode"
                colorLight="#fff"
                :text="formData.param1"
                :margin="0"
                :logoScale="0.3"
                :size="300"
            ></vue-qr>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="onSubmit"  v-if="formData.is_qrcode_passive == 1">下发到门禁</el-button>
            <el-button @click="onDialogClose">关闭</el-button>
        </div>
    </el-dialog>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { Action } from "vuex-class";
import vueQr from "vue-qr";
import { mixinDialogForm } from "@/mixin/dialog/Form";
@Component({
    mixins: [mixinDialogForm],
    components: {
        vueQr
    }
})
export default class equipmentIdAuthQrtr extends Vue {
    @Action("equipmentDoor/remote") itemEdit: any;
    editInit(data: any) {
        this.formData.yard_sn = data.yard_sn;
        this.formData.door_sn = data.door_sn;
        this.formData.door_name = data.door_name;
        this.formData.is_qrcode_passive = data.is_qrcode_passive;
        this.formData.param1 = 'https://userapp.park.hy-access.com/idauth/?code=' + data.idauth_str;
    }
    // 表单数据
    formData: any = {
        door_sn: "",
        is_qrcode_passive: 0,
        param1: "",
        yard_sn: "",
        cmd_type: 'confqr'
    };
}
</script>
